package com.finance.system.accountbook.transform;

import com.finance.system.accountbook.entity.CashRecordEntity;
import com.finance.system.accountbook.entity.CashRecordOutbound;

import java.util.ArrayList;
import java.util.List;

public class CashRecordTransform {
    public static CashRecordOutbound entityToOutBound(CashRecordEntity entity){
        CashRecordOutbound cashRecordOutbound = new CashRecordOutbound().setId(entity.getId())
                .setAmount(entity.getAmount())
                .setUserId(entity.getUserId())
                .setCloseFlag(entity.getCloseFlag());
        return cashRecordOutbound;
    }

    public static List<CashRecordOutbound> entityToOutBound(List<CashRecordEntity> entityList){
        ArrayList<CashRecordOutbound> list = new ArrayList<>();
        for (CashRecordEntity entity : entityList) {
            list.add(entityToOutBound(entity));
        }
        return list;
    }
}
